//
//  Test49.cpp
//  CPPTest
//
//  Created by you5 Yi on 2021/9/30.
//

#include "Test49.hpp"
#include <iostream>
using namespace std;
class Sample {
    int x,y;
public:
    Sample() {
        x=y=0;
    }
    Sample(int i,int j) {
        x=i;
        y=j;
    }
    void copy(Sample &s);
    void setxy(int i,int j) {
        x=i;
        y=j;
    }
    void print() {
        cout<<"x="<<x<<",y="<<y<<endl;
    }
};

void Sample::copy(Sample &s) {
    x=s.x;
    y=s.y;
}

void func(Sample s1, Sample &s2) {
    s1.setxy(10, 20);
    s2.setxy(30, 40);
}

void test49() {
    Sample p(1,2),q;
    q.copy(p);
    func(p, q);
    p.print();
    q.print();
}
